//
//  NSArrayAdditions.h
//  Tint
//
//  Created by Kevin Wu on 2/22/12.
//  Copyright (c) 2012 Telligenty. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>


@interface NSArray (Tint)

/*
 * Querying
 */
- (id)objectOrNilAtIndex:(NSUInteger)i;
- (id)firstObject;
- (id)randomObject;

/*
 * Ordering and filtering
 */
- (NSArray *)shuffledArray;
- (NSArray *)reversedArray;
- (NSArray *)nonEqualObjectsArray;
- (NSArray *)nonIdenticalObjectsArray;

/*
 * KVC
 */
- (CGFloat)avg:(NSString *)keyPath;
- (CGFloat)max:(NSString *)keyPath;
- (CGFloat)min:(NSString *)keyPath;
- (CGFloat)sum:(NSString *)keyPath;
- (NSArray *)unionOfObjects:(NSString *)keyPath;
- (NSArray *)nonEqualUnionOfObjects:(NSString *)keyPath;
- (NSArray *)nonIdenticalUnionOfObjects:(NSString *)keyPath;
- (NSArray *)objectsForKeyPath:(NSString *)keyPath equalToValue:(id)value;
- (NSArray *)objectsForKeyPath:(NSString *)keyPath identicalToValue:(id)value;
- (id)firstObjectForKeyPath:(NSString *)keyPath equalToValue:(id)value;
- (id)firstObjectForKeyPath:(NSString *)keyPath identicalToValue:(id)value;

/*
 * Sending messages
 */
- (void)makeObjectsRunSelector:(SEL)selector;
- (void)makeObjectsRunSelector:(SEL)selector withObject:(id)p1;
- (void)makeObjectsRunSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2;
- (void)makeObjectsRunSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObject:(id)p3;
- (void)makeObjectsRunSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObject:(id)p3 withObject:(id)p4;
- (void)makeObjectsRunSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObject:(id)p3 withObject:(id)p4 withObject:(id)p5;
- (void)makeObjectsRunSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObject:(id)p3 withObject:(id)p4 withObject:(id)p5 withObject:(id)p6;

- (void)makeObjectsRunSelectorOnMainThread:(SEL)selector;
- (void)makeObjectsRunSelectorOnMainThread:(SEL)selector withObject:(id)p1;
- (void)makeObjectsRunSelectorOnMainThread:(SEL)selector withObject:(id)p1 withObject:(id)p2;
- (void)makeObjectsRunSelectorOnMainThread:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObject:(id)p3;
- (void)makeObjectsRunSelectorOnMainThread:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObject:(id)p3 withObject:(id)p4;
- (void)makeObjectsRunSelectorOnMainThread:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObject:(id)p3 withObject:(id)p4 withObject:(id)p5;
- (void)makeObjectsRunSelectorOnMainThread:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObject:(id)p3 withObject:(id)p4 withObject:(id)p5 withObject:(id)p6;

@end
